import { createPinia } from 'pinia';
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import relativeTime from 'dayjs/plugin/relativeTime';
import Duration from 'dayjs/plugin/duration';

/** 按需引入 echarts*/
import * as echarts from 'echarts/core';
import { BarChart, LineChart, RadarChart, PieChart } from 'echarts/charts';
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  // 数据集组件
  DatasetComponent,
  // 内置数据转换器组件 (filter, sort)
  TransformComponent,
  LegendComponent,
  AxisPointerComponent,
} from 'echarts/components';
import { LabelLayout, UniversalTransition } from 'echarts/features';
import { CanvasRenderer } from 'echarts/renderers';

// 导入 Ant Design Vue 的 reset.css 文件
import 'ant-design-vue/dist/reset.css';
// 导入虚拟的 uno.css 文件
import 'virtual:uno.css';

// 导入全局样式
import '@/assets/style/reset-autofill.css';
// 修改spin的ant-spin-container的高度跟随父级高度
import '@/assets/style/spin.css';
// 修改tabs的.ant-tabs-content-top的高度跟随父级高度
import '@/assets/style/tabs.css';
// 修改表格行单击高亮样式
import '@/assets/style/table.css';

// 设置 dayjs 的语言为中文
dayjs.locale('zh-cn');
dayjs.extend(relativeTime);
dayjs.extend(Duration);

/** 按需引入 echarts*/
// 注册必须的组件
echarts.use([
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  BarChart,
  LineChart,
  LabelLayout,
  UniversalTransition,
  CanvasRenderer,
  RadarChart,
  PieChart,
  LegendComponent,
  AxisPointerComponent,
]);

const app = createApp(App);

app.use(createPinia());
app.use(router);

app.mount('#app');
